Summary: Error in BC++ 3.5 (automatic data segm exceeds 64K)
Keywords: C++ segment problems
X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #4]
hI!
If you have a solution for this problem, please send me a few lines with
indications. I am not a C programmer, and in a program I am having errors
like:"Linker Error: Automatic data segment exceeds 64K" or some times "A1
overlaps ... DGROUP ..."
I am using Borland C++ v3.5 as compiler...
I sumarize the problem, in the next 2 samples of code.. They are just a summary extracted from the DLL source, (without the LibMain & WEP and etc etc).
Sample of SOURCE FILE MYINCLUDE.H:
----------------------------------
......
extern "C" int FAR PASCAL _export allocmem (void);
extern "C" int FAR PASCAL _export movmem(void);
HANDLE hptr[500]; //hndl to allocmem
char far *ttt[500]; //pointer to allocated memory
.....
int FAR PASCAL allocmem (void)
{
extern HANDLE hptr[90];
extern char far * ttt[90] ;
int ii;
for (ii=0;ii<500;ii++)
{
hptr[ii] = GlobalAlloc(0x0000 , 200);
if(hptr[ii]==NULL) goto wrong;
ttt[ii]=(char *) GlobalLock(hptr[ii]);
}
wrong:
return ii;
}
Sample of SOURCE FILE EXAMPL1.CPP:
----------------------------------
#include <windows.h>
// #pragma codeseg movmem "movmem" movmem <-- comented out (did not work)
This did work fine, till I included more functions simmilars to 'movmem', trying
to fill the rest of the allocated memory with required data.
Then the KRNL386.EXE couldn't even start the DLL..
To visualize the problem I modified a simple windows example (whello.cpp) to
include in it similar code. And the KRNL386.EXE abended in the same address
0001:73C3... So I try differents ways to solve the problem.
I did spread these new routines in different new source files, trying to avoid linking limitations. But all I tried failed. Even renaming segments and
groups in the 'project ide' options.. (Borland C++ 3.5), or inserting
#pragma codeseg <"segm_name"> <group> , also did not lead me to solve the
problem.
I guess all is explained in the error message of the linker, when I compiled my modified "whello.cpp". I added into it, 2 sources (SRCFILE1.CPP & SRCFILE2.CPP) with routines similars to the 'movmem' above. The messages were:
Compiling WHELLO.CPP:
Compiling whello.rc:
Compiling SRCFILE1.CPP:
Compiling SRCFILE2.CPP:
Linking whello.exe:
Linker Error: Automatic data segment exceeds 64K
Please send me a few lines abut this... Thank you again.
Juan Jose.
e-mail: juanjose@melbpc.org.au
,-._|\ Juan Jose Suarez E-Mail: juanjose@melbpc.org.au
/ Oz \ 7/94 Beach Rd. Melbourne - 3194 - Australia